<template>
	<view class="main"></view>
</template>

<script>
	export default {
		data() {
			return {};
		},
		onLoad() {
			this.loadExecution();
		},
		methods: {
			loadExecution: function() {
				/**
				 * guidelaunchFlag: 首页中的步骤引导
				 * launchFlag :guid页，由于Index页，如果显示过则不再显示
				 */
				try {
					const guideFlag = uni.getStorageSync('guidelaunchFlag');
					if (guideFlag) {
						uni.switchTab({
							url: '/pages/index/index'
						});
					} else {
						const value = uni.getStorageSync('launchFlag');
						if (value) {
							uni.switchTab({
								url: '/pages/index/index'
							});
						} else {
							uni.redirectTo({
								url: '/pages/index/guide'
							});
						}
					}
				} catch (e) {
					// error
					uni.setStorage({
						key: 'launchFlag',
						data: true,
						success: function() {
							console.log('error时存储launchFlag');
						}
					});
					uni.redirectTo({
						url: '/pages/index/guide',
					});
				}
			}
		}
	};
</script>
<style>
	page,
	view {
		/* uni-app默认使用flex布局。因为flex布局有利于跨更多平台，尤其是采用原生渲染的平台。如不了解flex布局，请参考http://www.w3.org/TR/css3-flexbox/。若不需要flex布局可删除本行*/
		display: flex;
	}

	.main {
		flex: 1;
		display: -webkit-box;
		display: -webkit-flex;
		display: -ms-flexbox;
		display: flex;
		-webkit-box-orient: vertical;
		-webkit-box-direction: normal;
		-webkit-flex-direction: column;
		-ms-flex-direction: column;
		flex-direction: column;
		/*必须要设置成100%，不然如果有内容是横向排列的，则会看不到其它内容*/
		width: 100%;
	}
</style>
